<?php

/**
 * Users filter form base class.
 *
 * @package    sf_sandbox
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseUsersFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'civilite'         => new sfWidgetFormChoice(array('choices' => array('' => '', 'M' => 'M', 'Mme' => 'Mme', 'Melle' => 'Melle'))),
      'nom'              => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'prenom'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'email'            => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'mdp'              => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'inscription'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'newsletter'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'login'            => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'type'             => new sfWidgetFormChoice(array('choices' => array('' => '', 'Candidat' => 'Candidat', 'Modérateur' => 'Modérateur', 'Admin' => 'Admin'))),
      'etat'             => new sfWidgetFormFilterInput(),
      'ip'               => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'date_inscription' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'date_connexion'   => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'civilite'         => new sfValidatorChoice(array('required' => false, 'choices' => array('M' => 'M', 'Mme' => 'Mme', 'Melle' => 'Melle'))),
      'nom'              => new sfValidatorPass(array('required' => false)),
      'prenom'           => new sfValidatorPass(array('required' => false)),
      'email'            => new sfValidatorPass(array('required' => false)),
      'mdp'              => new sfValidatorPass(array('required' => false)),
      'inscription'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'newsletter'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'login'            => new sfValidatorPass(array('required' => false)),
      'type'             => new sfValidatorChoice(array('required' => false, 'choices' => array('Candidat' => 'Candidat', 'Modérateur' => 'Modérateur', 'Admin' => 'Admin'))),
      'etat'             => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'ip'               => new sfValidatorPass(array('required' => false)),
      'date_inscription' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'date_connexion'   => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('users_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Users';
  }

  public function getFields()
  {
    return array(
      'id'               => 'Number',
      'civilite'         => 'Enum',
      'nom'              => 'Text',
      'prenom'           => 'Text',
      'email'            => 'Text',
      'mdp'              => 'Text',
      'inscription'      => 'Date',
      'newsletter'       => 'Number',
      'login'            => 'Text',
      'type'             => 'Enum',
      'etat'             => 'Number',
      'ip'               => 'Text',
      'date_inscription' => 'Date',
      'date_connexion'   => 'Date',
    );
  }
}
